var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('/Users/jiangleivos/alibaba-work/DB/db');
var arr = ['02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20']
var s = 'CREATE TABLE "keyword_rst_?" ( "min_avgCpc" REAL, "min_avgPos" REAL, "min_clickPerDay" REAL, "min_totalCost" REAL, "max_avgCpc" REAL, "max_avgPos" REAL, "max_clickPerDay" REAL, "max_totalCost" REAL, "keyword" TEXT, "keyword_rowid" INTEGER);'
var s2 = 'CREATE TABLE "keyword_?" ( "keyword" TEXT, "isDone" INTEGER);'
var t = 'insert into keyword_? select keyword,0 from tmp;'
db.serialize(function() {
    console.log(s);
    function callback(){
        console.log(arguments)
    }
    arr.forEach(function(item) {
        // console.log(t.replace('?',item.toString()));
        db.exec(s.replace('?',item.toString()),callback);
        db.exec(s2.replace('?',item.toString()),callback);
        db.exec(t.replace('?',item.toString()),callback);
    })
})
// db.end();